<!--
   Created with IntelliJ IDEA.
   Description: 
   User: chensj
   Date: 2019-05-16
   Time: 11:12
 -->
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta http-equiv="X-UA-Compatible" content="ie=edge"/>
    <title>首页</title>
</head>
<body>
<h1>Hello Spring Security</h1>
<p>当前页面没有受保护，你可以进入已保护的界面</p>
<div th:fragment="logout" sec:authorize="isAuthenticated()">
    登录用户：<span sec:authentication="name"></span><br/>
    用户角色：<span sec:authentication="principal.authorities"></span><br/>
    <div>
        <form th:action="@{/logout}" method="post">
            <input type="submit" value="登出"/>
        </form>
    </div>
</div>
<ul>
    <li>点击<a th:href="@{/user/index}">去/user/index已保护的界面</a> </li>
    <li>点击<a th:href="@{/blog}">去/blog已保护的界面</a> </li>
</ul>
</body>
</html>